#ifndef __OSCDISPATCHER_H__
#define __OSCDISPATCHER_H__



#include "osc/OscReceivedElements.h"
#include "osc/OscPacketListener.h"
#include "ip/UdpSocket.h"


using namespace osc;


class OSCDispatcher  : public PacketListener
{
public:
	OSCDispatcher();
		void start(bool lk=false);
		void stop();
		void setGUI(idUserInterface *gui);
		SocketReceiveMultiplexer mux_;
		UdpReceiveSocket *socket;
		UdpTransmitSocket *socket2;
		idUserInterface *_mainmenu_gui;
			void ProcessPacket( const char *data, int size, const IpEndpointName& remoteEndpoint );
			void ProcessBundle(const ReceivedBundle& b, const IpEndpointName& remoteEndpoint);
	protected:
		void ProcessMessage( const ReceivedMessage& m, const IpEndpointName& remoteEndpoint);
public:
	~OSCDispatcher(void);
private:
		
		const char* cam_name;

		#ifndef WIN32
		pthread_t thread;
		#else
   		HANDLE thread;
		#endif	

		bool locked;
};

#endif /* !__OSCDISPATCHER_H__ */